import { Body, Controller, Get, HttpCode, Post } from '@nestjs/common';
import * as uuid from 'uuid'
import { IProject, ITestParams } from './interface'
import { ProjectsService } from './service'

@Controller('projects')
export class ProjectsController {
	constructor(private readonly service: ProjectsService) { }

	@Post()
	@HttpCode(200)
	list() {
		return this.service.list()
	}

	@Post('add')
	@HttpCode(200)
	add(@Body() body: IProject) {
		return this.service.add(body)
	}

	@Post('edit')
	@HttpCode(200)
	edit(@Body() body: IProject) {
		return this.service.edit(body)
	}

	@Post('del')
	@HttpCode(200)
	del(@Body('project_id') project_id: string) {
		return this.service.del(project_id)
	}

	@Post('get-tables')
	@HttpCode(200)
	get_tables(@Body('project_id') project_id: string) {
		return this.service.get_tables(project_id)
	}

	@Post('testmodel')
	@HttpCode(200)
	testmodel(@Body() body: ITestParams) {
		return this.service.testmodel(body)
	}
}
